package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.WalletAccountMapper;
import com.ruoyi.bizsys.domain.WalletAccount;
import com.ruoyi.bizsys.service.IWalletAccountService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 钱包账户Service业务层处理
 *
 * @author african-loan
 * @date 2022-06-17
 */
@Service
public class WalletAccountServiceImpl extends ServiceImpl<WalletAccountMapper,WalletAccount> implements IWalletAccountService {

    /**
     * 查询钱包账户
     *
     * @param id 钱包账户ID
     * @return 钱包账户
     */
    @Override
    public WalletAccount selectWalletAccountById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询钱包账户列表
     *
     * @param walletAccount 钱包账户
     * @return 钱包账户
     */
    @Override
    public List<WalletAccount> selectWalletAccountList(WalletAccount walletAccount) {
        return this.list(new QueryWrapper<>(walletAccount).last("order by id desc"));
    }

    /**
     * 新增钱包账户
     *
     * @param walletAccount 钱包账户
     * @return 结果
     */
            @Override
    public int insertWalletAccount(WalletAccount walletAccount) {
                                                                                                                                                                                walletAccount.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(walletAccount);
    }

    /**
     * 修改钱包账户
     *
     * @param walletAccount 钱包账户
     * @return 结果
     */
            @Override
    public int updateWalletAccount(WalletAccount walletAccount) {
                                                                                                                                                                                                                        walletAccount.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(walletAccount);
    }

    /**
     * 批量删除钱包账户
     *
     * @param ids 需要删除的钱包账户ID
     * @return 结果
     */
            @Override
    public int deleteWalletAccountByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除钱包账户信息
     *
     * @param id 钱包账户ID
     * @return 结果
     */
    @Override
    public int deleteWalletAccountById(Long id) {
        return baseMapper.deleteById(id);
    }

}
